﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ManYan.Domain.Model.Entity
{
    [Table("tb_user_refresh_token")]
    public class tb_user_refresh_token
    {
        /// <summary>
        /// 唯一ID
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// 这个刷新token属于哪个用户
        /// </summary>
        public Guid UserId { get; set; }
        /// <summary>
        /// 全局唯一的，可以通过token获取到UserID，反向生成access_token
        /// </summary>
        public string Token { get; set; }
        /// <summary>
        /// token的过期时间，这个过期时间是要大于aceess_token的过期时间
        /// </summary>
        public DateTime ValidDate { get; set; }
        /// <summary>
        /// 是否过期
        /// </summary>
        [NotMapped]
        public bool Valid => ValidDate > System.DateTime.Now;

    }
}
